#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
typedef struct ln
{
	int val;
	struct ln* next;
}ln;
ln* chuangjian(int x)
{
	ln* newln = (ln*)malloc(sizeof(ln*));
	newln->val = x;
	newln->next = NULL;	
	return newln;
}
bool panduan(ln* x)
{
	ln* fast = x;
	ln* slow = x;
	while (fast && fast->next)
	{
		fast = fast->next->next;
		slow = slow->next;
		if (fast == slow)
		{
			return true;
		}
	}
	return false;
}
int main()
{
	ln* s1 = chuangjian(1);
	ln* s2 = chuangjian(2);
	ln* s3 = chuangjian(3);
	ln* s4 = chuangjian(4);
	ln* s5 = chuangjian(5);
	s1->next = s2;
	s2->next = s3;
	s3->next = s4;
	s4->next = s5;
	s5->next = s2;
	bool as=panduan(s1);
	if (as == true)
	{
		printf("true");
	}
	else
		printf("false");
	return 0;

}